def maxsize(S):
    start_idx = 0
    end_idx = 0
    res =1
    for i in range(0,len(S)):
        if S[i] - S[start_idx] <= 10:
            end_idx = i
            res = end_idx-start_idx+1
        else:
            start_idx += 1
    return res

n = int(input())
S = list(map(int,input().split()))
S.sort()
print(maxsize(S))

